package com.itheima.object1;

import javax.swing.tree.TreeCellEditor;
import java.sql.SQLOutput;
import java.util.EmptyStackException;
import java.util.Scanner;

public class SignIn {
    public static void main(String[] args) {
        String name = "dukai";
        String password = "1234";

        Scanner sc = new Scanner(System.in);
        for (int i = 1; i <= 3; i++) {

            System.out.println("请输入账号!");
            String scName = sc.nextLine();
            System.out.println("请输入密码!");
            String pass = sc.nextLine();

            if (name.equals(scName) && password.equals(pass)) {
                System.out.println("登录成功!");
                break;
            } else {
                if (i == 3) {
                    System.out.println("今日次数已用完");
                } else {
                    if (!name.equals(scName) && !password.equals(pass)) {
                        System.out.println("账号密码都错误,还剩" + (3 - i) + "次机会");
                    } else if (!name.equals(scName)) {
                        System.out.println("账号错误还剩" + (3 - i) + "次机会");
                    } else if (!password.equals(pass)) {
                        System.out.println("密码错误,还剩" + (3 - i) + "次机会");
                    }
                }
            }

        }

    }

}



